# Handmade makefile for vex code

#compiler
CC := C:\mcc18\bin\mcc18.exe
LINKER := C:\mcc18\bin\mplink.exe

# build options
CFLAGS := -p=18F8520 /i"C:\mcc18\h"  -D__DEBUG -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa-

#files to compile
BASEOBJS := ifi_startup.o ifi_utilities.o main.o printf_lib.o 

USEROBJS := user_routines_fast.o user_routines.o user_utilities.o joey_routines.o

#default target
all:VexHex

#final target
VexHex: Base User
	$(LINKER) /l"C:\mcc18\lib" "18f8520user.lkr" $(BASEOBJS) $(USEROBJS) Vex_alltimers_wauton.lib /o"VexHex09.cof"
	 

Base: 
	$(CC) ifi_startup.c $(CFLAGS)
	$(CC) ifi_utilities.c $(CFLAGS)
	$(CC) main.c $(CFLAGS)
	$(CC) printf_lib.c $(CFLAGS) 

User:
	$(CC) user_routines_fast.c $(CFLAGS)
	$(CC) user_routines.c $(CFLAGS)
	$(CC) user_utilities.c $(CFLAGS)
	$(CC) joey_routines.c $(CFLAGS)
